{template '_header'}

<style>

    .form-group .container .input-group {margin-top: 10px;}
    .form-group .container .input-group:first-child {margin-top: 0;}
</style>


<div class='page-heading'><h2>积分签到</h2></div>
<form id="setform"  action="" method="post" class="form-horizontal form-validate" >

    <div class="form-group">
        <label class="col-sm-2 control-label">开启积分签到</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio radio-inline">
                <input type="radio" value="0" name="data[centeropen]"> 关闭
            </label>
            <label class="radio radio-inline">
                <input type="radio" value="1" name="data[centeropen]" checked=""> 开启
            </label>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">积分签到链接<br>(点击复制)</label>
        <div class="col-sm-9 col-xs-12">
            <p class='form-control-static'><a href='javascript:;' class="js-clip" title='点击复制链接' data-url="{php echo mobileUrl('creditshop/sign',null,true)}" >{php echo mobileUrl('creditshop/sign',null,true)}</a></p>
        </div>
    </div>

    <div class="form-group-title">签到规则</div>

    <div class="form-group">
        <label class="col-sm-2 control-label">签到周期</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio radio-inline"><input type="radio" value="0" name="da" class="change" data-show="" data-hide=".signdate"> 自然月</label>
            <label class="radio radio-inline"><input type="radio" value="1" name="da" class="change" data-show=".signdate" data-hide="" checked=""> 指定日期</label>
            <span class="signdate">
                {php echo tpl_form_field_daterange('saletime', array('starttime'=>date('Y-m-d', $item['timestart']),'endtime'=>date('Y-m-d', $item['timeend'])),false);}
            </span>
            <div class="help-block">自然月周记为当前月的天数，指定日期则可选择指定日期范围内</div>
        </div>
    </div>

    <div class="form-group signdate">
        <label class="col-sm-2 control-label">非周期内签到</label>
        <div class="col-sm-9 col-xs-12">
            <div class="input-group">
                <span class="input-group-addon">是否允许签到</span>
                <span class="form-control">
                    <label class="checkbox-inline" style="padding-top: 0;"><input type="checkbox" name="repair" value="1" checked> 允许</label>
                </span>
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分 每天奖励</span>
                <input class="form-control" value="0" />
                <span class="input-group-addon" style="border-left: 0;">积分</span>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">普通奖励</label>
        <div class="col-sm-9 col-xs-12">
            <div class="input-group">
                <span class="input-group-addon">首次奖励</span>
                <input class="form-control" value="10" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分 每天奖励</span>
                <input class="form-control" value="1" />
                <span class="input-group-addon" style="border-left: 0;">积分</span>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">高级奖励</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio radio-inline"><input type="radio" value="0" name="da2" class="change" data-show="" data-hide=".reward"> 关闭高级奖励</label>
            <label class="radio radio-inline"><input type="radio" value="1" name="da2" class="change" data-show=".reward1" data-hide=".reward2"> 连续签到得奖励</label>
            <label class="radio radio-inline"><input type="radio" value="2" name="da2" class="change" data-show=".reward2" data-hide=".reward1" checked=""> 总签到得奖励</label>
        </div>
    </div>

    <div class="form-group reward reward1" style="display: none;">
        <label class="col-sm-2 control-label">连续签到</label>
        <div class="col-sm-9 col-xs-12 container">
            <div class="input-group">
                <span class="input-group-addon">连续签到</span>
                <input class="form-control" value="3" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">天 奖励</span>
                <input class="form-control" value="10" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分</span>
                <span class="form-control btn btn-default delrule">删除</span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">连续签到</span>
                <input class="form-control" value="7" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">天 奖励</span>
                <input class="form-control" value="50" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分</span>
                <span class="form-control btn btn-default delrule">删除</span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">连续签到</span>
                <input class="form-control" value="15" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">天 奖励</span>
                <input class="form-control" value="100" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分</span>
                <span class="form-control btn btn-default delrule">删除</span>
            </div>
            <div class="input-group form-control btn btn-default addrule" data-type="1"><i class="fa fa-plus"></i> 添加一个规则</div>
        </div>
    </div>

    <div class="form-group reward reward2">
        <label class="col-sm-2 control-label">总签到</label>
        <div class="col-sm-9 col-xs-12 container">
            <div class="input-group">
                <span class="input-group-addon">总签到</span>
                <input class="form-control" value="3" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">天 奖励</span>
                <input class="form-control" value="10" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分</span>
                <span class="form-control btn btn-default delrule">删除</span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">总签到</span>
                <input class="form-control" value="7" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">天 奖励</span>
                <input class="form-control" value="50" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分</span>
                <span class="form-control btn btn-default delrule">删除</span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">总签到</span>
                <input class="form-control" value="15" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">天 奖励</span>
                <input class="form-control" value="100" />
                <span class="input-group-addon" style="border-left: 0; border-right: 0;">积分</span>
                <span class="form-control btn btn-default delrule">删除</span>
            </div>
            <div class="input-group form-control btn btn-default addrule" data-type="2"><i class="fa fa-plus"></i> 添加一个规则</div>
        </div>
    </div>




          
         <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9">
            	{ifp 'creditshop.cover.edit'}
                	<input type="submit" value="提交" class="btn btn-primary" />
                {/if}
            </div>
        </div>
   
</form>


<script type="text/javascript">
    $(function () {
        $(".change").on('click', function () {
            var show = $(this).data('show');
            var hide = $(this).data('hide');
            if (show) {
                $(show).show();
            }
            if (hide) {
                $(hide).hide();
            }
        });

        $(".addrule").on('click', function () {
            var _this = $(this);
            var type = _this.data('type');
            // qingqiu tpl
            $.get("{php echo webUrl('creditshop/sign/tpl')}", function (tpl) {
                _this.before(tpl);
            });
        });

        $(document).on('click','.reward .delrule', function () {
            $(this).closest('.input-group').remove();
        });
    });
</script>





{template '_footer'}